package com.printValue;

import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class SpringCollection {//集合型的注入,对象的注入，数组的注入
	private String name;
	private List<Object> list;
	private Map<String,String> map;
	private Set<String> set;
	private Student student;
	private String[] strArr;//数组
	
	public SpringCollection(String name){
		this.name = name;
		System.out.println("constructor注入："+name);//构造器注入的值
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public void setList(List<Object> list) {
		this.list = list;
	}

	public void setMap(Map<String, String> map) {
		this.map = map;
	}

	public void setSet(Set<String> set) {
		this.set = set;
	}

	public void setStudent(Student student) {
		this.student = student;
	}
	
	public void setStrArr(String[] strArr) {
		this.strArr = strArr;
	}

	public void print(){
		System.out.println("property注入："+name);
		System.out.println("----list----");
		for(Object l:list){
			System.out.print(l+" ");
		}
		System.out.println();
		System.out.println("---set---");
		for(String s:set){
			System.out.print(s+" ");
		}
		System.out.println();
		System.out.println("---map---");
		for(Entry<String, String> entity:map.entrySet()){
			System.out.print(entity.getKey()+":"+entity.getValue()+" ");
		}
		System.out.println();
		System.out.println("----注入类----");
		student.p();
		
		System.out.println();
		System.out.println("----注入数组----");
		for(String s1:strArr){
			System.out.print(s1+" ");
		}
	}
}
